﻿@model WebUI.Models.aspnet_Users
@using (Ajax.BeginForm(new AjaxOptions()
{
    LoadingElementId = "OnLoadingSpan",
    UpdateTargetId = "DoctorListView",
    InsertionMode = InsertionMode.Replace,
    HttpMethod = "Post",
    OnSuccess = "$('#dialogbox').dialog('close');",
    OnFailure = "OnSiteError"
}))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>医生信息</legend>
        @Html.HiddenFor(model => model.UserId)
        <table width="100%">
            <tr>
                <td>
                    @Html.EditorFor(model => model.UserName, "TxtField")
                    <div class="editor-label">
                        密码<i>[只有创建或想修改密码是才需填写]</i>
                    </div>
                    <div class="editor-field">
                        @Html.TextBox("Pwd")
                    </div>
                    @Html.EditorFor(model => model.MobileAlias, "TxtField")
                    @Html.EditorFor(model => model.Email, "TxtField")
                    <div class="editor-label">
                        是否是主任医生：
                    </div>
                    <div class="editor-field">
                        @Html.CheckBoxFor(model => model.IsDoctorDepManager) @Html.LabelFor(model => model.IsDoctorDepManager)
                    </div>
                </td>
                <td>
                    <div class="editor-label">
                        所属单位：
                    </div>
                    <div class="editor-field">
                        @Html.HiddenFor(model => model.DepartmentID, new { id = "CV" })
                        @Html.TextBox("DepartmentTitle2", Model.Department == null ? "请选择" : Model.Hospital.HospCode+Model.BingQu.Title+ Model.Department.DepName, new { id = "CT", disabled= true,style="width:300px"})
                        <a title="选择。数据很多，请耐心等待..." href="#" onclick="$('#treeviewselector').load('@(Url.Action("BingQuTree", new { cv = "CV", ct = "CT" }))',null,function(){showDialogEx('#treeviewselector','请选择',true);});return false;">
                            [选择…]</a>&nbsp;
                    </div>
                    @Html.EditorFor(model => model.AccountStatus, "StsField")
                    @Html.EditorFor(model => model.Gender, "SelField", new { Selects = new SelectList(new string[] { "男", "女" }, Model.Gender) })
                </td>
            </tr>
        </table>
        <p>
            <input type="submit" value="确定" />
        </p>
    </fieldset>
    
    <script type="text/javascript">
        $(function () {
            $("#HospitalID").change(function () {
                var acturl="@(Url.Action("DepListByHospital", "ShareData"))/"+$("#HospitalID").val();
                $("#DepartmentID").load(acturl);
            });
            @if (Model.UserId == Guid.Empty)
            {
                @:$("#DepartmentID").load("@(Url.Action("DepListByHospital", "ShareData"))/"+$("#HospitalID").val());
            }
        });
    </script>
}
<div id="treeviewselector">
</div>
